package com.kyriec.controller;

import com.kyriec.Util.EResult;
import com.kyriec.entity.Users;
import com.kyriec.params.LoginParam;
import com.kyriec.service.UsersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 用户(Users)表控制层
 *
 * @author KyrieC
 * @since 2023-11-25 11:58:12
 */
@RestController
@RequestMapping("user")
public class UsersController {
    /**
     * 服务对象
     */
    @Autowired
    private UsersService usersService;

    @PostMapping("login")
    public EResult<Users> login(@RequestBody LoginParam loginParam){
        System.out.println(loginParam);
        return usersService.login(loginParam);
    }

    @PostMapping("register")
    public EResult register(@RequestBody Users users){
        System.out.println(users);
        return usersService.register(users);
    }

}

